import request from "@/utils/request";
import type { ResponseData } from "@/api/user/type";
import type { TradeMarkResponseData, TradeMark } from "./type";
enum API {
  TRADEMARK_URL = "/admin/product/baseTrademark/",
  ADDTRADMARK_URL = "/admin/product/baseTrademark/save",
  UPDATAMARK_URL = "/admin/product/baseTrademark/update",
  DELETETRADEMARK_URL = "/admin/product/baseTrademark/remove/",
}
//获取已有品牌属性
export const reqHasTrademark = (page: number, limit: number) => {
  return request.get<any, ResponseData<TradeMarkResponseData<TradeMark>>>(
    `${API.TRADEMARK_URL}${page}/${limit}`
  );
};
//新增｜添加品牌
export const reqAddOrUpdate = (data: TradeMark) => {
  if (data.id) {
    return request.put<any, any>(API.UPDATAMARK_URL, data);
  } else {
    return request.post<any, any>(API.ADDTRADMARK_URL, data);
  }
};
//删除某个已有品牌属性
export const reqDeleteTrademark = (id: number) => {
  return request.delete<any, any>(`${API.DELETETRADEMARK_URL}${id}`);
};
